package com.acme.bankapp.domain.bank.gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.GridBagLayout;
import javax.swing.JLabel;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import com.acme.bankapp.domain.bank.client.Gender;
import javax.swing.JRadioButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JList;
import javax.swing.ListSelectionModel;
import javax.swing.AbstractListModel;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.ListSelectionEvent;

public class MainFrame extends JFrame {

	private JPanel contentPane;
	private JTextField textName;
	private JList listAccounts;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MainFrame frame = new MainFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public MainFrame() {
		setTitle("Add new client");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 397, 260);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		GridBagLayout gbl_contentPane = new GridBagLayout();
		gbl_contentPane.columnWidths = new int[] {66, 165, 66};
		gbl_contentPane.rowHeights = new int[] {0, 0, 0, 0, 0};
		gbl_contentPane.columnWeights = new double[]{1.0, 1.0, 0.0, 0.0};
		gbl_contentPane.rowWeights = new double[]{0.0, 0.0, 1.0, 0.0, 0.0};
		contentPane.setLayout(gbl_contentPane);

		JLabel labelName = new JLabel("Name:");
		GridBagConstraints gbc_labelName = new GridBagConstraints();
		gbc_labelName.insets = new Insets(0, 0, 5, 5);
		gbc_labelName.anchor = GridBagConstraints.EAST;
		gbc_labelName.gridx = 0;
		gbc_labelName.gridy = 0;
		contentPane.add(labelName, gbc_labelName);

						textName = new JTextField();
						GridBagConstraints gbc_textName = new GridBagConstraints();
						gbc_textName.gridwidth = 3;
						gbc_textName.insets = new Insets(0, 0, 5, 5);
						gbc_textName.fill = GridBagConstraints.HORIZONTAL;
						gbc_textName.gridx = 1;
						gbc_textName.gridy = 0;
						contentPane.add(textName, gbc_textName);
						textName.setColumns(10);

		JLabel labelGender = new JLabel("Gender:");
		GridBagConstraints gbc_labelGender = new GridBagConstraints();
		gbc_labelGender.anchor = GridBagConstraints.EAST;
		gbc_labelGender.insets = new Insets(0, 0, 5, 5);
		gbc_labelGender.gridx = 0;
		gbc_labelGender.gridy = 1;
		contentPane.add(labelGender, gbc_labelGender);

				JComboBox comboBoxGender = new JComboBox();
				comboBoxGender.setModel(new DefaultComboBoxModel(Gender.values()));
				GridBagConstraints gbc_comboBoxGender = new GridBagConstraints();
				gbc_comboBoxGender.gridwidth = 3;
				gbc_comboBoxGender.insets = new Insets(0, 0, 5, 5);
				gbc_comboBoxGender.fill = GridBagConstraints.HORIZONTAL;
				gbc_comboBoxGender.gridx = 1;
				gbc_comboBoxGender.gridy = 1;
				contentPane.add(comboBoxGender, gbc_comboBoxGender);

		listAccounts = new JList();
		listAccounts.addListSelectionListener(new ListSelectionListener() {
			public void valueChanged(ListSelectionEvent e) {
				
			}
		});
		listAccounts.setModel(new AbstractListModel() {
			String[] values = new String[] {};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		listAccounts.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		GridBagConstraints gbc_listAccounts = new GridBagConstraints();
		gbc_listAccounts.gridwidth = 4;
		gbc_listAccounts.insets = new Insets(0, 0, 5, 0);
		gbc_listAccounts.fill = GridBagConstraints.BOTH;
		gbc_listAccounts.gridx = 0;
		gbc_listAccounts.gridy = 2;
		contentPane.add(listAccounts, gbc_listAccounts);

		JButton buttonAddAccount = new JButton("Add");
		GridBagConstraints gbc_buttonAddAccount = new GridBagConstraints();
		gbc_buttonAddAccount.insets = new Insets(0, 0, 5, 5);
		gbc_buttonAddAccount.gridx = 2;
		gbc_buttonAddAccount.gridy = 3;
		contentPane.add(buttonAddAccount, gbc_buttonAddAccount);

		JButton buttonDeleteAccount = new JButton("Delete");
		buttonDeleteAccount.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {

			}
		});
		GridBagConstraints gbc_buttonDeleteAccount = new GridBagConstraints();
		gbc_buttonDeleteAccount.insets = new Insets(0, 0, 5, 0);
		gbc_buttonDeleteAccount.gridx = 3;
		gbc_buttonDeleteAccount.gridy = 3;
		contentPane.add(buttonDeleteAccount, gbc_buttonDeleteAccount);

		JButton buttonOk = new JButton("OK");
		GridBagConstraints gbc_buttonOk = new GridBagConstraints();
		gbc_buttonOk.insets = new Insets(0, 0, 0, 5);
		gbc_buttonOk.gridx = 2;
		gbc_buttonOk.gridy = 4;
		contentPane.add(buttonOk, gbc_buttonOk);

		JButton buttonClose = new JButton("Close");
		buttonClose.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});
		GridBagConstraints gbc_buttonClose = new GridBagConstraints();
		gbc_buttonClose.gridx = 3;
		gbc_buttonClose.gridy = 4;
		contentPane.add(buttonClose, gbc_buttonClose);
	}

}
